<?php

namespace app\admin\model\procure;

use think\Model;

/**
 * Purchorders
 */
class Purchorders extends Model
{
    // 表主键
    protected $pk = 'orderno';
    
    // 表名
    protected $name = 'procure_purchorders';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;


    public function suppliernoTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\procure\Suppliers::class, 'supplierno', 'supplierid');
    }

    public function initiatorTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\Admin::class, 'initiator', 'id');
    }

    public function intostocklocationTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\stock\Locations::class, 'intostocklocation', 'loccode');
    }

    public function paymenttermsTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Paymentterms::class, 'paymentterms', 'termsindicator');
    }
}